package com.example.boot01.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@Controller
public class HelloController {
    @RequestMapping("/hello")
    public void hello(HttpServletResponse response) throws IOException {
        // 设置相应类型
        response.setContentType("text/html;charset=utf-8");
        // 得到输出对象
        PrintWriter pw = response.getWriter();
        // 给客户端发送响应
        pw.println("测试成功");
        // 关闭资源
        pw.close();
    }

}
